package cn.virens.database.serviceimpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.virens.database.mysql.mapper.sys.SysResourceMapper;
import cn.virens.database.mysql.mapper.sys.SysRoleMapper;
import cn.virens.database.mysql.mapper.sys.SysUserMapper;
import cn.virens.web.components.shiro.ShiroAuthenticationInterface;
import cn.virens.web.components.shiro.ShiroAuthorizingInterface;

@Service
public class LoginServiceImpl implements ShiroAuthorizingInterface, ShiroAuthenticationInterface {
	private @Resource SysUserMapper sysUserMapper;
	private @Resource SysRoleMapper sysRoleMapper;
	private @Resource SysResourceMapper sysResourceMapper;

	@Override
	public void onLoginSuccess(String username, String host) {

	}

	@Override
	public void onLoginFailure(String username, String host) {
	}

	@Override
	public String login(String account) {
		return sysUserMapper.login(account);
	}

	@Override
	public List<String> getRoles(String account) {
		return sysRoleMapper.getRoles(account);
	}

	@Override
	public List<String> getResources(String account) {
		return sysResourceMapper.getResources(account);
	}

}
